
$(function () {
    $("#file").change(function () {
        var fn = file.value;
        console.log(fn);
        $("#showFileName").text("已选择："+fn);
    })
})
$(function () {
    $("#questionadd").click(function () {
        var form = new FormData(document.getElementById("fileForm"));
        $.ajax({
            url: "/admin/import",
            type: "post",
            data: form,
            processData: false,
            contentType: false,
            async: false,
            success: function (data) {
                var isExist = data.isExist;
                if (isExist) {
                    popBox();
                } else {
                    popBox1();
                }
            }
        });
    });
})
function popBox(){
    var msg = document.getElementById('msg');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "block";
    msg.style.display = "block";
}//end func popBox()

function popBox1(){
    var finexam = document.getElementById('finexam');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "block";
    finexam.style.display = "block";
}//end func popBox()
function closeBox(){
    var popBox = document.getElementById('msg');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "none";
    popBox.style.display = "none";
    window.history.back(-1);
}//end func closeBox()
function cancelBox(){
    var finexam = document.getElementById('finexam');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "none";
    finexam.style.display = "none";
}//end func closeBox()